package com.ttg.utils.connection.handler;

//~--- non-JDK imports --------------------------------------------------------


import com.ttg.utils.Assert;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;

//~--- JDK imports ------------------------------------------------------------

//~--- classes ----------------------------------------------------------------

/**
 * Class BaseHttpResponse
 * Description
 * Create 2015-09-11 15:33:14
 * @author Ardy
 */
public class BaseHttpResponse implements Serializable {

    /**
     * Field serialVersionUID
     * Description
     */
    private static final long serialVersionUID = -873248996124308992L;

    /**
     * Field signatureAlgorithm
     * Description
     */
    private String signatureAlgorithm;

    /**
     * Field signatureInfo
     * Description
     */
    private String signatureInfo;

    /**
     * Field bizParameters
     * Description
     */
    private byte[] bizParameters;

    /**
     * Field charset
     * Description
     */
    private final Charset charset;

    /**
     * Constructs BaseHttpResponse
     * Description
     *
     * @param charset
     */
    public BaseHttpResponse(Charset charset) {
        Assert.notNull(charset, "[Assertion failed] - this argument[charset] is required; it must not be null");
        this.charset = charset;
    }

    /**
     * Method getSignatureAlgorithm
     * Description
     *
     * @return String
     */
    public String getSignatureAlgorithm() {
        return this.signatureAlgorithm;
    }

    /**
     * Method setSignatureAlgorithm
     * Description
     *
     * @param signatureAlgorithm String
     */
    public void setSignatureAlgorithm(String signatureAlgorithm) {
        this.signatureAlgorithm = signatureAlgorithm;
    }

    /**
     * Method getSignatureInfo
     * Description
     *
     * @return String
     */
    public String getSignatureInfo() {
        return this.signatureInfo;
    }

    /**
     * Method setSignatureInfo
     * Description
     *
     * @param signatureInfo String
     */
    public void setSignatureInfo(String signatureInfo) {
        this.signatureInfo = signatureInfo;
    }

    /**
     * Method getCharset
     * Description
     *
     * @return Charset
     */
    public Charset getCharset() {
        return this.charset;
    }

    /**
     * Method getBizParameters
     * Description
     *
     * @return byte[]
     */
    public byte[] getBizParameters() {
        return this.bizParameters;
    }

    /**
     * Method getBizParametersAsString
     * Description
     *
     * @return String
     *
     * @throws UnsupportedEncodingException
     */
    public String getBizParametersAsString() throws UnsupportedEncodingException {
        return ( this.bizParameters != null ) ? new String(this.bizParameters, this.charset.name()) : null;
    }

    /**
     * Method setBizParameters
     * Description
     *
     * @param bizParameters byte[]
     */
    public void setBizParameters(byte[] bizParameters) {
        this.bizParameters = bizParameters;
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
